#!/usr/bin/env node

const fs=require('fs'),
      err=console.error,
      lnk=process.argv[2];//软链接

if(typeof(lnk) === 'undefined' || process.argv.length !== 3) {
  err('命令行参数不正确!');
}

try{
  //console.log(lnk, '->', fs.readlinkSync(lnk));
  const src=fs.readlinkSync(lnk);
  console.log(`${lnk}->${src}`);//打印软链接
} catch(e) {
    err(e.message);
}

